import { SaaSOrgParams, SaaSOrgItem, SaaSOrgDto } from './model/organizationModel';
import { tenantHttp } from '/@/utils/http/axios';

enum Api {
  SaaSOrgTree = '/organization/getOrgTree',
  CreateOrg = '/organization/createOrg',
  UpdateOrg = '/organization/updateOrg',
  SaaSOrgDelte = '/organization/delete/',
}

export const getSaaSOrgTree = (params?: SaaSOrgParams) => {
  return tenantHttp.get<SaaSOrgItem[]>({ url: Api.SaaSOrgTree, params });
};

export const createOrg = (params: SaaSOrgDto) => {
  // 创建/编辑组织
  return tenantHttp.post<boolean>({ url: Api.CreateOrg, params });
};
export const updateOrg = (params: SaaSOrgDto) => {
  // 创建/编辑组织
  return tenantHttp.post<boolean>({ url: Api.UpdateOrg, params });
};

export const deleteSaaSOrg = (params: string) => {
  // 删除组织 - 组织ID
  return tenantHttp.delete<boolean>({ url: Api.SaaSOrgDelte + params });
};
